MenuItemCompat

(SESL modified) Helper for accessing features in MenuItem.

Note: You cannot get an instance of this class. Instead, it provides static methods that correspond to the methods in , but take a MenuItem object as an additional argument.

Types

Link copied to clipboard
Interface definition for a callback to be invoked when a menu item marked with SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW is expanded or collapsed.

Properties

Link copied to clipboard
Link copied to clipboard
Always show this item as a button in an Action Bar.
Link copied to clipboard
This item's action view collapses to a normal menu item.
Link copied to clipboard
Show this item as a button in an Action Bar if the system decides there is room for it.
Link copied to clipboard
Never show this item as a button in an Action Bar.
Link copied to clipboard
When this item is in the action bar, always show it with a text label even if it also has an icon specified.

Functions

Link copied to clipboard
Collapse the action view associated with this menu item.
Link copied to clipboard
Expand the action view associated with this menu item.
Link copied to clipboard
@Nullable
open fun getActionProvider(@NonNull item: @NonNull MenuItem): @Nullable ActionProvider
Gets the ActionProvider.
Link copied to clipboard
open fun getActionView(item: MenuItem): View
Returns the currently set action view for this menu item.
Link copied to clipboard
open fun getAlphabeticModifiers(@NonNull item: @NonNull MenuItem): Int
Return the modifier for this menu item's alphabetic shortcut.
Link copied to clipboard
@Nullable
open fun getContentDescription(@NonNull item: @NonNull MenuItem): @Nullable CharSequence
Retrieve the content description associated with this menu item.
Link copied to clipboard
@Nullable
open fun getIconTintList(@NonNull item: @NonNull MenuItem): @Nullable ColorStateList
Link copied to clipboard
open fun getIconTintMode(@NonNull item: @NonNull MenuItem): @Nullable PorterDuff.Mode
Returns the blending mode used to apply the tint to the item's icon, if specified.
Link copied to clipboard
open fun getNaviMenuItemType(@NonNull menuItem: @NonNull MenuItem): Int
Gets the navigation menu item type of the provided menu item.
Link copied to clipboard
open fun getNumericModifiers(@NonNull item: @NonNull MenuItem): Int
Return the modifiers for this menu item's numeric (12-key) shortcut.
Link copied to clipboard
@Nullable
open fun getTooltipText(@NonNull item: @NonNull MenuItem): @Nullable CharSequence
Retrieve the tooltip text associated with this menu item.
Link copied to clipboard
Returns true if this menu item's action view has been expanded.
Link copied to clipboard
@Nullable
open fun setActionProvider(@NonNull item: @NonNull MenuItem, @Nullable provider: @Nullable ActionProvider): @Nullable MenuItem
Sets the ActionProvider responsible for creating an action view if the item is placed on the action bar.
Link copied to clipboard
open fun setActionView(item: MenuItem, view: View): MenuItem
open fun setActionView(item: MenuItem, resId: Int): MenuItem
Set an action view for this menu item.
Link copied to clipboard
open fun setAlphabeticShortcut(@NonNull item: @NonNull MenuItem, alphaChar: Char, alphaModifiers: Int)
Change the alphabetic shortcut associated with this item.
Link copied to clipboard
open fun setContentDescription(@NonNull item: @NonNull MenuItem, @Nullable contentDescription: @Nullable CharSequence)
Change the content description associated with this menu item.
Link copied to clipboard
open fun setIconTintList(@NonNull item: @NonNull MenuItem, @Nullable tint: @Nullable ColorStateList)
Applies a tint to the item's icon.
Link copied to clipboard
open fun setIconTintMode(@NonNull item: @NonNull MenuItem, tintMode: @Nullable PorterDuff.Mode)
Specifies the blending mode used to apply the tint specified by setIconTintList to the item's icon.
Link copied to clipboard
open fun setNumericShortcut(@NonNull item: @NonNull MenuItem, numericChar: Char, numericModifiers: Int)
Change the numeric shortcut and modifiers associated with this item.
Link copied to clipboard
Set an OnActionExpandListener on this menu item to be notified when the associated action view is expanded or collapsed.
Link copied to clipboard
open fun setSeslNaviMenuItemType(@NonNull menuItem: @NonNull MenuItem, itemType: Int)
Sets the navigation menu item type of the provided menu item.
Link copied to clipboard
open fun setShortcut(@NonNull item: @NonNull MenuItem, numericChar: Char, alphaChar: Char, numericModifiers: Int, alphaModifiers: Int)
Change both the numeric and alphabetic shortcut associated with this item.
Link copied to clipboard
open fun setShowAsAction(item: MenuItem, actionEnum: Int)
Sets how this item should display in the presence of a compatible Action Bar.
Link copied to clipboard
open fun setTooltipText(@NonNull item: @NonNull MenuItem, @Nullable tooltipText: @Nullable CharSequence)
Change the tooltip text associated with this menu item.